package com.feri.ssm.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.logging.SimpleFormatter;

@Data
public class Pet {
    private Integer id;
    private String name;
    private String type;
    private String variety;
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
    private Date birthday;
    private String image;
    private String info;
    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
    private Date ctime;

    @Override
    public String toString() {
        return
                 "ID=" + id +
                " 宠物名='" + name + '\'' +
                " 宠物类型='" + type + '\'' +
                " 宠物品种='" + variety + '\'' +
                " 生日=" + new SimpleDateFormat("yyyy-MM-dd").format(birthday)+
                " 照片='" + image + '\'' +
                " 简介='" + info + '\'' +
                " 创建时间=" + new SimpleDateFormat("yyyy-MM-dd").format(ctime)
                ;
    }
}
